/*
*  events.h - MSN Events
*  Copyright (c) 2005 Derek Ingrouville (dergro@users.sourceforge.net)
*
*  This program is free software; you can redistribute it and/or modify
*  it under the terms of the GNU General Public License as published by
*  the Free Software Foundation; either version 2 of the License, or
*  (at your option) any later version.
*
*  This program is distributed in the hope that it will be useful,
*  but WITHOUT ANY WARRANTY; without even the implied warranty of
*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*  GNU Library General Public License for more details.
*
*  You should have received a copy of the GNU General Public License
*  along with this program; if not, write to the Free Software
*  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/

#ifndef _EVENTS_H
#define _EVENTS_H

#include <glib.h>

#include "cbtable.h"

/***  

Current list of events

contact_added: Contact was added to the contact list
contact_info_changed: Contact information has changed
group_added: A group was added to the contact list
sync_finished: Contact list synchronization has finished
switchboard_invited: Invited to a switchboard session

***/

typedef enum _MsnEventID
{
	CONTACT_ADDED,
	CONTACT_INFO_CHANGED,
	GROUP_ADDED,
	GROUP_REMOVED,
	SYNC_FINISHED,
	SWITCHBOARD_INVITED,
	USER_NICKNAME_CHANGED,
	USER_STATUS_CHANGED,
	INVALID_EVENT
} MsnEventID;

typedef struct _MsnEvent
{
	MsnEventID id;
	char *name;
	gpointer user_data; /* Event specific data */
} MsnEvent;

typedef struct _MsnEventQueue
{
	GQueue *queue;
	unsigned int length; /* Number of events in queue */
} MsnEventQueue;

/* Initialize a new event queue */
MsnEventQueue *msn_event_queue_new (void);

/* Free the entire queue, and the data in even data struct */
void msn_event_queue_free (MsnEventQueue *equeue);

/* Frees the event structure, data should be freed in event handler */
void msn_event_free (MsnEvent *event);

/* Add an event to the end of queue */
int msn_event_add (MsnEventQueue *equeue,
				   char *event_name,
				   gpointer event_data);

/* Get the first event in the queue */
MsnEvent *msn_get_event (MsnEventQueue *equeue);

gboolean msn_event_available (MsnEventQueue *equeue);

#endif /* _EVENTS_H */

